Virtualization technology makes it possible to run multiple virtual machines on a single physical machine. Multiple virtual machines running on the same hardware require the ability to share input/output (I/O) devices such as disk drives and network adapters. Two traditional approaches to implementing virtual machine I/O are emulation and paravirtualization. Emulation is accomplished by implementing an I/O device as software. This software implementation (i.e. the emulated I/O device) is controlled by a hypervisor (i.e. a virtualization platform), and a virtual machine accesses the emulated I/O device as though it was a real hardware device. While emulation is the simplest method for implementing an I/O device on a hypervisor, it is the least efficient (i.e. slowest) access method due the additional software layer required to access the physical device.
A block diagram illustrating the prior art method of controlling an I/O device without virtualization is shown in FIG. 1. The block diagram, generally referenced 10, comprises operating system 12, device driver 14 and physical I/O device 16. Operating system 12 communicates with physical I/O device 16 via device driver 14.
A block diagram illustrating the prior art method of controlling an I/O device via emulation is shown in FIG. 2A. The block diagram, generally referenced 20, comprises s guest operating system 22, guest device driver 23, device emulator 24, hardware device driver 26 and physical I/O device 28. Guest operating system 22 (a virtual machine) performs I/O by communicating with device emulator 26 (a component of the hypervisor) via guest device driver 23. Device emulator 24 communicates with I/O device 28 via hardware device driver 26. As shown in FIGS. 1 and 2A, performing I/O by emulation requires additional software layers which results in less efficiency. The advantage of emulation is that the virtual machine (i.e. the guest operating system) is not aware that it is running on a virtualization platform (e.g., a fully virtualized Windows running on either VMware or Xen).
Paravirtualization is a more efficient (i.e. than emulation) method of virtual machine I/O employing paravirtualized drivers which are virtual I/O drivers. This in effect creates a virtual I/O device, where the virtual machine is aware of the fact that it is running on a hypervisor. The virtual machine communicates with the hypervisor in order to access the paravirtualized device. Paravirtualization is implemented when the virtual machine is designed to run on a hypervisor (e.g., a paravirtualized Linux on either POWER Hypervisor or Xen).
A block diagram illustrating the prior art method of controlling an I/O device via paravirtualization is shown in FIG. 2B. The block diagram, generally referenced 30, comprises guest operating system 32, paravirtualized driver 34, hardware device driver 36 and physical I/O device 38. Guest operating system (a virtual machine) 32 communicates with I/O device 38 by communicating with paravirtualized driver 34. Paravirtualized driver 34 then issues calls to hardware device driver 36 controlling I/O device 38. Paravirtualization is much more efficient than emulation since it does not have the overhead of the additional emulation software layer. Paravirtualization provides an indirect conduit for a virtual machine to communicate with a physical I/O device.
A third approach to virtual machine I/O is to grant a virtual machine direct access to a peripheral hardware device. Due to limitations of modern computer architectures, this approach has been rarely used because without special hardware support since it violates basic isolation guarantees. Virtual machines with direct access to a hardware device could overtake the machine by programming the device to perform a direct memory access (DMA) anywhere in memory, including over the hypervisor. This issue is specifically addressed by the introduction of input/output memory management units (IOMMUs). IOMMUs are hardware devices that translate device DMA addresses to machine addresses. An isolation capable IOMMU restricts a physical I/O device so that it can only access to the specific sections of memory allocated to the physical I/O device. Hypervisors utilize IOMMUs to grant secure direct hardware access to virtual machines.
A block diagram illustrating the prior art method of controlling an I/O device via direct access (also called “pass through”) is shown in FIG. 2C. The block diagram, generally referenced 40 comprises guest operating system 42, hardware device driver 44 and physical I/O device 46. Guest operating system 42 (a virtual machine) communicates with I/O device 46 directly via hardware device driver 44.
Direct access significantly improves I/O performance. However, IOMMUs can impose a performance penalty due to the extra memory accesses required to perform DMA operations. Additionally, using direct hardware access with legacy (non-self-virtualizing) adapters has certain limitations such as disabling live migration and requiring the exclusive dedication of a physical I/O device to a single virtual machine.
IO mechanisms (i.e. emulation, paravirtualization and direct access) are currently assigned to a virtual machine upon startup of the virtual machine. If an I/O mechanism needs to be changed, the virtual machine associated with the I/O mechanism needs to be (1) shut down, (2) reconfigured for the new I/O mechanism and (3) restarted with the new I/O mechanism. In addition, as the workload the machine runs changes, the initial assignment of I/O mechanisms will become sub-optimal. Therefore there is a need for a mechanism that is able to assign the appropriate I/O mechanism to each virtual machine so that overall system performance is optimized. The mechanism should be fully autonomous, guest operating system independent and should be able to control a wide variety of I/O devices. In addition, the mechanism should account for the addition and removal of virtual machines running on the hypervisor, and should be able to change the I/O device configurations of the virtual machines as their respective needs change.